<template>
  <div class="g-form lp-card">
    <div class="lp-card__title">
      <span>LP TOKENS IN YOU WALLET</span>
    </div>
    <div class="lp-card__list">
      <div class="item">
        <div class="token">
          <img :src="token0.icon" />
          <img :src="token1.icon" />
          <span>{{ token0.symbol }}/{{ token1.symbol }}</span>
        </div>
        <span>{{ userLiquidity }}</span>
      </div>
      <div class="item">
        <span>{{ token0.symbol }}</span>
        <span>{{ amountA }}</span>
      </div>
      <div class="item">
        <span>{{ token1.symbol }}</span>
        <span>{{ amountB }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    pair: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  computed: {
    token0() {
      return (this.pair && this.pair.token0) || {};
    },
    token1() {
      return (this.pair && this.pair.token1) || {};
    },
    amountA() {
      return (this.pair && this.pair.amountA) || 0;
    },
    amountB() {
      return (this.pair && this.pair.amountB) || 0;
    },
    totalSupply() {
      return (this.pair && this.pair.totalSupply) || 0;
    },
    userLiquidity() {
      return (this.pair && this.pair.userLiquidity) || 0;
    },
  },
};
</script>

<style lang="scss" scoped>
.lp-card {
  padding: 28px 30px 18px;
  margin: 20px auto 0;

  &__title {
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 10px;

    span {
      font-size: 14px;
      font-family: "Roboto Medium";
      color: var(--color-content);
    }
  }

  &__list {
    .item {
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: space-between;

      span {
        font-size: 14px;
        font-family: "Roboto Medium";
      }

      .token {
        display: flex;
        align-items: center;
        justify-content: flex-start;

        img {
          width: 24px;
          border-radius: 12px;
        }

        span {
          margin-left: 10px;
        }
      }
    }
  }
}
</style>
